{template 'admin','header'}
<form name="searchform" action="{$self_url}" method="get">
    <table cellpadding="0" cellspacing="1" class="table_form" >
        <caption>管理友情链接</caption>
        <tr>
            <td>
                {if check_perms('rlink_add')}<a href="{$self_url}?action=add"><font color="red">添加友情链接</font></a>{/if}
                <select name="tcode" style="float:right" onchange="document.searchform.submit()">
                    <option value="">按所属分类查看</option>
                    {loop $codelist $i $n}
                    <option value="{$i}" {if $i==$tcode}selected{/if}>{$n}</option>
                    {/loop}
                </select>
            </td>
        </tr>
    </table>
</form>
<form name="myform" method="post" action="{$self_url}">
    <table cellpadding="0" cellspacing="1" class="table_list">
        <caption>友情链接列表</caption>
        <tr>
            <th width="30">排序</th>
            <th>网站名称</th>
            <th width="240">网站Logo</th>
            <th width="120">所属分类</th>
            <th width="80">链接类型</th>
            <th width="80">操作</th>
        </tr>
        {loop $data $r}
        <tr>
            <td class="align_c"><input size="3" name="listorder[{$r['id']}]" type="text" value="{$r['listorder']}"></td>
            <td><a href="{$r['url']}" target='_blank' ><span class="">{$r['name']}</span></a> </td>
            <td class="align_c">{if !empty($r['logo'])}<img src="{$r['logo']}" onload="setpicWH(this,300,300)">{/if}</td>
            <td class="align_c">{if isset($codelist[$r['tcode']])}{$codelist[$r['tcode']]}{else}未分类{/if}</td>
            <td class="align_c">{$types[$r['type']]}</td>
            <td class="align_c">
                {if check_perms('rlink_edit')}<a href="{$self_url}?action=edit&id={$r['id']}">修改</a> |{else}<span style="color:#ccc">修改</span> |{/if}
                {if check_perms('rlink_delete')}<a href="javascript:void(0)" onclick="my_request('{$self_url}?action=delete&id={$r['id']}','确定要删除吗？')">删除</a>{else}<span style="color:#ccc">删除</span>{/if}
            </td>
        </tr>
        {/loop}
    </table>
    <div class="button_box">
        <input name="order" type="button" value=" 排序 " onclick="change_opt('myform','{$self_url}?action=listorder')"/>
    </div>
</form>

<div id="pages">{$pages}</div>
{template 'admin','footer'}